package com.literature.search.core.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * api请求记录表
 * </p>
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Document
@ApiModel(value="ApiLog对象", description="api请求记录表")
public class ApiLog implements Serializable {

	private static final long serialVersionUID = 1L;

	@ApiModelProperty(value = "请求id")
	private Long id;

	@ApiModelProperty(value = "客户端ip")
	private String reqIp;

	@ApiModelProperty(value = "请求api")
	private String reqApi;

	@ApiModelProperty(value = "请求参数")
	private String reqParame;

	@ApiModelProperty(value = "请求类型（GET、POST...）")
	private String reqType;

	@ApiModelProperty(value = "请求token")
	private String reqToken;

	@ApiModelProperty(value = "请求header")
	private String reqHeader;

	@ApiModelProperty(value = "返回-状态码")
	private Integer resCode;

	@ApiModelProperty(value = "返回-信息描述")
	private String resMsg;

	@ApiModelProperty(value = "返回-整个信息字符串形式")
	private String resString;

	@ApiModelProperty(value = "user_id")
	private Long userId;

	@ApiModelProperty(value = "admin_id")
	private Long adminId;

	@ApiModelProperty(value = "请求开始时间")
	private Date startTime;

	@ApiModelProperty(value = "请求结束时间")
	private Date endTime;

	@ApiModelProperty(value = "花费时间，单位ms")
	private Integer costTime;



	/**
	 * 构造一个普通 实体类
	 */
	public ApiLog() {}
	
	// 构造一个 save 实体类 
	public ApiLog(Long id, String reqIp, String reqApi, String reqParame, String reqToken, long userId, long adminId) {
		super();
		this.id = id;
		this.reqIp = reqIp;
		this.reqApi = reqApi;
		this.reqParame = reqParame;
		this.reqToken = reqToken;
		this.userId = userId;
		this.adminId = adminId;
	}

	// 构造一个 update 实体类 
	public ApiLog(Long id, Integer resCode, String resMsg, String resString, Integer costTime) {
		super();
		this.id = id;
		this.resCode = resCode;
		this.resMsg = resMsg;
		this.resString = resString;
		this.costTime = costTime;
	}

	
	
	
	

}
